package auth

import (
	"github.com/gin-gonic/gin"
	"scaffold-demo/controllers/auth"
)

func login(authGroup *gin.RouterGroup) { //登陆路由
	authGroup.POST("/login", auth.Login) //登陆路由分组，使用auth.Login控制器来验证用户名及密码，并校验token
}

func logout(authGroup *gin.RouterGroup) { //退出路由
	authGroup.GET("/logout", auth.Logout) //退出路由分组，使用auth.logout
}

func RegisterSubRouters(g *gin.RouterGroup) { //接收路由主组件传过来的分组
	authGroup := g.Group("/auth") //在api分组下拆分一个auth分组
	login(authGroup)              //在auth分组下拆分登录路由
	logout(authGroup)             //在auth分组下拆分退出路由
}
